import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { FormsModule } from '@angular/forms';
import { CloudSharedModule } from '../../shared/shared.module';
import { ConfigService } from '../../core/common/config.service';
import { Http, XSRFStrategy, XHRBackend, RequestOptions } from '@angular/http';
import { LocalXSRFStrategy } from '../../core/http/local-xsrf-strategy.service';
import { httpFactory } from '../../core/http/http.factory';
import { PayMoneyComponent } from './paymoney/paymoney.component';
import { SettleManageComponent } from './settlemanage/settlemanage.component';
import { SettlementComponent } from './settlement/settlement.component';
import { AdJustaccountComponent } from './adjustaccount/adjustaccount.component';
import { Router } from '@angular/router';
import { CustomerService } from '../crm/service/customer.service';
const routes: Routes = [
  { path: '', redirectTo: 'console/account' },
  { path: 'paymoney', component: PayMoneyComponent },
  { path: 'settle', component: SettleManageComponent },
  { path: 'settledetail/:ttid/:ttchid', component: SettlementComponent },
  { path: 'adjustAccount', component: AdJustaccountComponent },
];

@NgModule({
  imports: [
    CloudSharedModule,
    RouterModule.forChild(routes),
    FormsModule
  ],
  declarations: [PayMoneyComponent, SettleManageComponent, SettlementComponent, AdJustaccountComponent],
  exports: [
    RouterModule
  ],
  providers: [ConfigService, CustomerService,
    {
      provide: XSRFStrategy, useClass: LocalXSRFStrategy,
    },
    {
      provide: Http,
      useFactory: httpFactory,
      deps: [XHRBackend, RequestOptions, ConfigService, Router]
    }
  ]
})
export class AccountModule { }
